package com.me.modules.report.controller;

import com.me.modules.common.controller.BaseController;
import com.me.modules.common.utils.JsonUtil;
import com.me.modules.report.service.TskReportService;
import com.me.modules.sys.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * 事件报表
 *
 * @author lill
 * @email lill5270@163.com
 * @date 2019-01-16 17:20:30
 */
@Controller
@RequestMapping("/report/tskreport")
public class TskReportController extends BaseController{
	@Autowired
	private TskReportService chgReportService;
	@Autowired
	private CodeService codeService;



	/**
	 * 列表
	 */
	@RequestMapping("/TskTypePie")
//	@RequiresPermissions("srminfo:list")
//	@SysLog("查询变更列表")
	public String TskTypePie(@RequestParam Map<String, Object> params, Model model , HttpServletRequest request){
		List<Object> list =chgReportService.TskTypePie(params);
		model.addAttribute("params",params);
		model.addAttribute("data",JsonUtil.getJsonByObj(list));
		return "report/assign/TskTypePie";
	}



	/**
	 * 列表
	 */
	@RequestMapping("/TskLineMonthNumber")
//	@RequiresPermissions("srminfo:list")
//	@SysLog("查询变更列表")
	public String TskLineMonthNumber(@RequestParam Map<String, Object> params, Model model , HttpServletRequest request){
		Date endDate= (Date) params.get("endDate");
		if(endDate==null){
			params.put("endDate",new  Date());
		}
		List<Object> list =chgReportService.TskLineMonthNumber(params);
		model.addAttribute("params",params);
		model.addAttribute("data",JsonUtil.getJsonByObj(list));
		return "report/assign/TskLineMonthNumber";
	}






}
